<?php

use yii\grid\GridView;
use common\helpers\Html;
use common\helpers\Url;
use common\helpers\ImageHelper;
use common\models\bonus\Bonus;
use common\enums\BonusEnum;
use yii\widgets\ActiveForm;


$this->title = '分布奖管理';
$this->params['breadcrumbs'][] = ['label' => $this->title];

?>

<div class="row">
    <div class="col-xs-12">
        <div class="box">
             <div class="box-header">
                <h3 class="box-title"><?= $this->title; ?></h3>
                <div class="box-tools">
                    
                </div>
            </div>
            <div class="login-box" style="margin-top: 0px;margin-bottom: 20px;">
            <!-- /.login-logo -->
            <div class="login-box-body">
                <p class="login-box-msg">分布奖及合作奖结算前预算</p>
                <!-- 2020-09-04 文档要求去掉红色字体 -->
                <!-- <p class="text-danger">2000以下不额外扣除，2000--10000额外扣10%，10000以上额外扣20%</p> -->  

                <?php $form = ActiveForm::begin([
                        'id' => 'login-form'
                ]); ?>

                <?= $form->field($model, 'bonus_tax_fb_amount')->textInput(); ?>
                <?= $form->field($model, 'bonus_tax_fb_pro')->textInput(); ?>
                <?= $form->field($model, 'bonus_tax_hz_amount')->textInput(); ?>
                <?= $form->field($model, 'bonus_tax_hz_pro')->textInput(); ?>
                <?= $form->field($model, 'bonus')->textInput(['readonly'=>'readonly']); ?>
                <?= $form->field($model, 'tax')->textInput(['readonly'=>'readonly']); ?>
                <?= $form->field($model, 'fee')->textInput(['readonly'=>'readonly']); ?>
                <?= $form->field($model, 'payment')->textInput(['readonly'=>'readonly']); ?>
                <?= $form->field($model, 'nbb')->textInput(['readonly'=>'readonly']); ?>
                <?= $form->field($model, 'zbb')->textInput(['readonly'=>'readonly']); ?>
                <div class="form-group">
                    <?= Html::submitButton('保存修改', ['class' => 'btn btn-primary btn-block', 'name' => 'login-button']) ?>
                </div>
                <?php ActiveForm::end(); ?>
            </div>
            <!-- /.login-box-body -->
        </div>
            <div class="box-body table-responsive">
                <?= GridView::widget([
                    'dataProvider' => $dataProvider,
                    // 'filterModel' => $searchModel,
                    //重新定义分页样式
                    'tableOptions' => ['class' => 'table table-hover rf-table'],
                    'columns' => [
                        [
                            'class' => 'yii\grid\SerialColumn',
                            'visible' => false, // 不显示#
                        ],
                        [
                            'attribute' => 'created_at',
                            'filter' => false, //不显示搜索框
                            'format' => ['date', 'php:Y-m-d H:i:s'],
                        ],
                        [
                            'attribute' => 'name',
                            'filter' => false, //不显示搜索框
                        ],
                        [
                            'attribute' => 'ye_ji',
                            'filter' => false, //不显示搜索框
                        ],
                        [
                            'attribute' => 'bonus',
                            'filter' => false, //不显示搜索框
                        ],
                        [
                            'attribute' => 'tax',
                            'filter' => false, //不显示搜索框
                        ],
                        [
                            'attribute' => 'fee',
                            'filter' => false, //不显示搜索框
                        ],
                        [
                            'attribute' => 'payment',
                            'filter' => false, //不显示搜索框
                        ],
                        [
                            'attribute' => 'calc_at',
                            'value' => function($model){
                                if ($model->calc_at > 0) {
                                    return date('Y-m-d H:i:s', $model->calc_at);
                                } else {
                                    return '未结算';
                                    // return Html::a('立即结算', Url::to(['dp-calc', 'id'=>$model->id]), ['class'=>'btn btn-sm btn-danger', 'onclick'=>'if(!confirm("是否确认立即结算？"))return false;']);
                                }
                            },
                            'format' => 'raw',
                            'filter' => false, //不显示搜索框

                        ],
                 
                    ],
                ]); ?>
            </div>
        </div>
    </div>